package test;

import java.util.Vector;

import server.core.ServerCore;
import entity.UserInfo;

/**
 * a test for databaseserver
 * 
 * @author Bell
 * 
 */
public class Main {
	public static void main(String[] args) throws Exception {
		UserInfo tmp = new UserInfo();

		// tmp = DatabaseServer.login("lijiarui", "111");
		// System.out.println(tmp.getName());

		/*
		 * tmp.setName("asd"); tmp.setPassword("111"); tmp.setIsAdmin(false);
		 * tmp.setNickname("asd"); tmp.setSchool(""); boolean res =
		 * DatabaseServer.addUser(tmp); System.out.println(res);
		 */

		// boolean res = DatabaseServer.addFriend(1, "gaoxiangyu");
		// System.out.println(res);

		long user = 4;
		Vector<UserInfo> res = ServerCore.findUser(user, "pig");
		for (int i = 0; i < res.size(); i++) {
			tmp = res.get(i);
			System.out.println(tmp.getUID() + " " + tmp.getName() + " "
					+ tmp.getNickname() + " " + tmp.getSchool());
		}

		/*
		 * ti.setText("I am a pig!"); ti.setUID(2); ti.setType(1); boolean res =
		 * DatabaseServer.publishNewsfeed(ti); System.out.println(res);
		 */

		/*
		 * long user = 4; Vector<TextInfo> res =
		 * DatabaseServer.viewNewsfeed(user); System.out.println(res.size());
		 * for(int i = 0; i < res.size(); i++) { ti = res.get(i);
		 * System.out.println(ti.getTID() + " " + ti.getText() + " " +
		 * ti.getUID() + " " + ti.getName() + " " + ti.getDatetime() + " " +
		 * ti.getType()); }
		 */
	}
}
